import request from '@/utils/request'

// 消息类型管理API
export const messageTypeApi = {
    // 获取所有消息类型
    getList: () => request.get('/message/type/list'),

    // 获取启用消息类型
    getEnabled: () => request.get('/message/type/enabled'),

    // 根据ID获取消息类型
    getById: (id) => request.get(`/message/type/${id}`),

    // 新增消息类型
    add: (data) => request.post('/message/type', data),

    // 修改消息类型
    update: (data) => request.put('/message/type', data),

    // 禁用消息类型
    disable: (id) => request.delete(`/message/type/${id}`),

    // 启用消息类型
    enable: (id) => request.post(`/message/type/${id}/enable`)
}

// 消息记录管理API
export const messageRecordApi = {
    // 获取消息记录列表
    getList: (params) => request.get('/message/record/list', { params }),

    // 根据ID获取消息详情
    getById: (id) => request.get(`/message/record/${id}`),

    // 发送消息
    send: (data) => request.post('/message/record', data),

    // 搜索消息
    search: (params) => request.get('/message/record/search', { params }),

    // 标记为已读
    markAsRead: (id) => request.put(`/message/record/${id}/read`)
}